package com.xjy.rpc.register;

import com.xjy.rpc.register.impl.RegisterServiceImpl;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class RpcRegisterFactory {


    private static Map<String,IRegisterService> registerServiceMap = new ConcurrentHashMap<>();


    static {
        registerServiceMap.put("redis",new RegisterServiceImpl());
    }

    public static IRegisterService getBean(String type){
        if (registerServiceMap.containsKey(type))
            return registerServiceMap.get(type);
        throw new NullPointerException("no such registerType" + type);
    }
}
